#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QString>
#include <QLineEdit>
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->m_con_status->setText(QString("disconnected"));
}

MainWindow::~MainWindow()
{
    delete ui;
}

//m_edit_input,m_edit_show_1,m_edit_show_2 and m_edit_show_3 are the QLineEdit
//connect and disconnect are the QPushButton
//when the button(connect) is clicked,m_edit_shows will change their text with m_edit_input
void MainWindow::on_connect_clicked()
{
    connect(ui->m_edit_input,SIGNAL(textChanged(QString)),ui->m_edit_show_1,SLOT(setText(QString)));
    connect(ui->m_edit_input,SIGNAL(textChanged(QString)),ui->m_edit_show_2,SLOT(setText(QString)));
    connect(ui->m_edit_input,SIGNAL(textChanged(QString)),ui->m_edit_show_3,SLOT(setText(QString)));
    ui->m_con_status->setText(QString("connected"));

}
void MainWindow::on_disconnect_clicked()
{
    disconnect(ui->m_edit_input,0,0,0);
    ui->m_con_status->setText(QString("disconnected"));
}
